#pragma once
#include "Object.h"

class ObjectManager
{
public:
	ObjectManager();
	int GetSize();
	Object & operator[] (const Value &Index);
	
	bool AddAttributeToObject(const Value &Index, const Value &NewAttribute);
	bool RemoveAtttributeFromObject(const Value &Index, const Value &OldAttribute);
	int GetNumberOfAttributesFromObject(const Value &Index);
	Value &GetBaseAttributeFromObject(const Value &Index, const Value &Name);
	Value GetModifiedAttributeFromObject(const Value &Index, const Value &Name);

	bool AddEffectToObject(const Value &Index, const Effect &NewEffect);
	bool RemoveEffectFromObject(const Value &Index, const Value &EffectIndex);
	int GetNumberOfEffectsFromObject(const Value &Index);	
	Effect &GetEffectFromObject(const Value &Index, const Value &EffectIndex);

	bool AddEventToObject(const Value &Index, const Event &NewEvent);
	bool RemoveEventFromObject(const Value &Index, const Value &EventIndex);
	int GetNumberOfEventsFromObject(const Value &Index);
	Event &GetEventFromObject(const Value &Index, const Value &EventIndex);
	
	bool AddChildToObject(const Value &Index, const Value &ChildIndex);
	bool RemoveChildFromObject(const Value &Index, const Value &ChildIndex);
	int GetNumberOfChildrenFromObject(const Value &Index);
	Object &GetChildFromObject(const Value &Index, const Value &ChildIndex);

	bool AddObject();
	bool AddObject(const Object &NewObject);
	static Object Error;

	void Clear();
private:
	Container<Object> Objects;
	bool CheckValidIndex(const Value &Index);
};

extern ObjectManager m_ObjectManager;